package com.hpf.redis7.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

@ConfigurationProperties(prefix = "spring.redis", ignoreUnknownFields = false)
@Data
public class RedisProperties {
    private int database;
    /**
     * 等待节点回复命令的时间。该时间从命令发送成功时开始计时
     */
    private int timeout = 3000;
    private String password;
    private String mode;
    /**
     * 池配置
     */
    private RedisPoolProperties pool;
    /**
     * 单机信息配置
     */
    private RedisSingleProperties single;

    @Data
    public static class RedisPoolProperties {
        private int maxIdle;
        private int minIdle;
        private int maxActive;
        private int maxWait;
        private int connTimeout = 10000;
        private int soTimeout;
        /**
         * 池大小
         */
        private int size;
    }

    @Data
    public static class RedisSingleProperties {
        private String address1;
        private String address2;
        private String address3;
    }
}
